﻿@model dynamic

@{
    ViewBag.Title = "添加文章";
    Layout = "~/Views/Shared/AdminLayout.cshtml";
}

<div class="am-g">
    <div class=" am-u-sm-8">
        <form class="am-form" method="POST" action="@Url.Action("AddArticle","Article")"> 
            <div class="am-form-group">
                <label for="Titel">标题</label>
                <input  type="text" class="" id="Titel" name="Titel" placeholder="输入标题">
            </div>
            <script id="editor" name="Comment" type="text/plain" style="width:1024px;height:500px;">
            </script>
            
            <p>
                <input class="am-btn am-btn-success" type="submit" value="提交" />
                <button class="am-btn" type="button" onclick="yulan(ue.getContent())"> 预览</button>
            </p>  
        </form>
        <form id="yulan">
            <input type="hidden" name="h"/>
        </form>
    </div>
</div>
@section scripts{


    <!-- 加载编辑器的容器 -->

    <script type="text/javascript" charset="utf-8" src="/Resource/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/Resource/ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="/Resource/ueditor/lang/zh-cn/zh-cn.js"></script>

    <script>
        //实例化编辑器
        //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
     
        UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
        UE.Editor.prototype.getActionUrl = function (action) {
            return "/res/UEditorHandler?action=" + action;
        }

        var ue = UE.getEditor('editor');

        function yulan(html) {
            $('[name=h]').val(html);

            window.open("/Article/yl?h="+html);
        }
    </script>


}